/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.whatisjee.ssf.remote.rs;

import com.whatisjee.ssf.domain.entity.Role;
import com.whatisjee.ssf.domain.entity.User;
import com.whatisjee.ssf.domain.service.AppService;
import java.util.List;
import javax.ejb.EJB;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.UriInfo;
import javax.ws.rs.PathParam;
import javax.ws.rs.Consumes;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.GET;
import javax.ws.rs.Produces;
import javax.enterprise.context.RequestScoped;

/**
 * REST Web Service
 *
 * @author max.m.yuan@gmail.com
 */
@Path("/")
@RequestScoped
public class AppServiceREST {

    @Context
    private UriInfo context;
    
    @EJB
    private AppService appService;

    /**
     * Creates a new instance of AppServiceREST
     */
    public AppServiceREST() {
    }
    
    @GET
    @Path("roles")
    @Produces("application/json")
    public List<Role> findRoles() {
        return appService.findRoles();
    }

    @GET
    @Path("user/{id}")
    @Produces("application/json")
    public User findUser(@PathParam("id") Integer id) {
        return appService.findUser(id);
    }
}
